package com.example.day16_mp;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.SeekBar;

import androidx.appcompat.app.AppCompatActivity;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

public class MainActivity extends AppCompatActivity {
        List<Music.DataBean> list = new ArrayList<>();
    private SeekBar seek;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        list.add(new Music.DataBean("http://10.161.9.80:8080/res/music/mp3/36024806.mp3"));
        list.add(new Music.DataBean("http://10.161.9.80:8080/res/music/mp3/1405283464.mp3"));
        list.add(new Music.DataBean("http://10.161.9.80:8080/res/music/mp3/449818741.mp3"));
        MusicUtils.getInstance().setList(list);//将歌曲列表添加到工具类中
    }
    private void initView() {
        seek = (SeekBar) findViewById(R.id.seek);
    }

    public void play(View view) {
        MusicUtils.getInstance().play(0);
    }

    public void pause(View view) {
        MusicUtils.getInstance().playOrPause(new ImageView(this));
    }

    public void pre(View view) {
        MusicUtils.getInstance().pre();
    }

    public void forward(View view) {
        MusicUtils.getInstance().jin();
    }
}